/**
 * EMailNotification.java
 * 2010-1-14
 */
package com.dlplay.flightinfo.client;

import java.util.logging.Logger;

import com.dlplay.flightinfo.data.RealTimeFlightInfo;

/**
 * @author zhao yu
 *
 */
public class EMailNotification implements Notification {
	private static final Logger log = Logger.getLogger(EMailNotification.class.getName());	 	
	
	private String user;
	private String email;
	private RealTimeFlightInfo oldFlight;
	private RealTimeFlightInfo newFlight;

	/* (non-Javadoc)
	 * @see com.dlplay.flightinfo.client.Notification#doNotification()
	 */
	@Override
	public void doNotification() {
		//TODO Send the email, add advertisement from adsManager
		if(oldFlight==null)
		{
			//TODO welcome the client
			log.info("Welcome "+user+" email: "+email);
		}
		log.info("doNotification "+this.toString());
	}

	/**
	 * @param user
	 * @param email
	 * @param oldFlight
	 * @param newFlight
	 */
	public EMailNotification(String user, String email, RealTimeFlightInfo oldFlight,
			RealTimeFlightInfo newFlight) {
		super();
		this.user = user;
		this.email = email;
		this.oldFlight = oldFlight;
		this.newFlight = newFlight;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "EMailNotification [email=" + email + ", newFlight=" + newFlight
				+ ", oldFlight=" + oldFlight + ", user=" + user + "]";
	}

}
